package enumandlambda;

/**
 * @author shkstart
 * @create 2022-11-29-11:02
 */
public class ThreadDemo13 {
    public static void main(String[] args) {
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                //得到当前执行的线程
                Thread t =Thread.currentThread();
                //打印线程id
                System.out.println(t.getName()+"---线程ID"+t.getId());
                System.out.println(t.getName()+"---线程名称: "+t.getName());
                System.out.println(t.getName()+"线程优先级:"+t.getPriority());
            }
        };
        Thread thread = new Thread(runnable,"线程1");
        thread.start();


        Thread thread2 = new Thread(runnable,"线程2");
        thread2.start();
        Thread thread3 = new Thread(runnable,"线程3");
        thread3.start();
    }
}
